home *** CD-ROM | disk | FTP | other *** search
/ Directorty Opus 5 - Magellan 2 / Opus 5 - Magellan 2.iso / Extras / DOpus511 / dopus_pch.lha / ARexx.lha / Arexx / Compare.dopus5 < prev    next >
Text File  |  1995-05-13  |  3KB  |  95 lines

  1. /* Compare v1.01 [13-May-1995] for Directory Opus 5
  2.    By Leo Davidson ("Nudel", P0T-NOoDLE/Gods'Gift Utilities)
  3.  
  4.    Using an external AmigaDOS compare program, this will compare either:
  5. a) the first two selected entries in the source lister (if more than one
  6.    entry is selected in the source lister), or,
  7. b) the selected entry in the source lister with the first selected entry
  8.    in the destination lister.
  9.  
  10. Where multiple soure/destination listers are open, only those listed
  11. first by DOpus5 will be used - so for the desired results you should
  12. only have one source and one destination lister (or just one source
  13. if you have two entries selected in it).
  14.  
  15. Note: Whether comparing two directories, or even a directory with a
  16.       file, works or not depends on the "Compare" command you use. This
  17.       script will send the selected ENTRIES (file OR dir!) to the command -
  18.       after this what happens is entirely up to the command itself!
  19.  
  20. Call as:
  21. ------------------------------------------------------------------------------
  22. ARexx    Compare.dopus5 {Qp}
  23. ------------------------------------------------------------------------------
  24. The "Output to window" and "Window close button" switches should both be on.
  25.  
  26. You should change the "Address Command..." line near the end to work with
  27. whatever Compare command you prefer to use (you'll at least have to change
  28. it's path).
  29. */
  30.  
  31.  
  32. /*-- Main Program -----------------------------------------------------------*/
  33. options results
  34. options FAILAT 99
  35. signal on syntax;signal on ioerr
  36. PARSE ARG DOpusPort
  37. If DOpusPort~="" THEN Address value DOpusPort
  38. ELSE Do
  39.     Say "Not correctly called from Directory Opus 5!"
  40.     Say "Load this ARexx script into editor for more info."
  41.     EXIT
  42.     END
  43.  
  44. lister query source
  45. IF RC ~= 0 Then Do
  46.     dopus request '"You must have a SOURCE lister!" OK'
  47.     EXIT
  48.     End
  49. Source_Handle = WORD(RESULT,1)
  50.  
  51. lister query Source_Handle numselentries
  52. If RESULT = 0 Then Do
  53.     dopus request '"You must have at least one entry' X2C(0A) 'selected in the SOURCE lister!" OK'
  54.     EXIT
  55.     End
  56.  
  57. lister query Source_Handle firstsel
  58. First_Name = RESULT
  59. lister select Source_Handle First_Name 0
  60. lister query Source_Handle path
  61. First_Name = Strip(RESULT,"B",'"')||Strip(First_Name,"B",'"')
  62. lister refresh Source_Handle
  63.  
  64. lister query Source_Handle numselentries
  65. If RESULT = 0 Then Do
  66.     lister query dest
  67.     IF RC ~= 0 Then Do
  68.         dopus request '"If you do not select TWO entries in the SOURCE lister,' X2C(0A) 'you must have a DESTINTION lister as well!" OK'
  69.         EXIT
  70.         END
  71.     Source_Handle = WORD(RESULT,1)
  72.     END
  73.  
  74. lister query Source_Handle numselentries
  75. If RESULT = 0 Then Do
  76.     dopus request '"You must select a second entry in' X2C(0A) 'either the SOURE or DEST lister!" OK'
  77.     EXIT
  78.     END
  79.  
  80. lister query Source_Handle firstsel
  81. Second_Name = RESULT
  82. lister select Source_Handle Second_Name 0
  83. lister query Source_Handle path
  84. Second_Name = Strip(RESULT,"B",'"')||Strip(Second_Name,"B",'"')
  85. lister refresh Source_Handle
  86.  
  87. Say 'Compare: "'First_Name'"'
  88. Say '   with: "'Second_Name'"'
  89. Say
  90.  
  91. Address Command 'DH0:Tools/System/Utils/Compare_ "'First_Name'" "'Second_Name'"'
  92.  
  93. syntax:;ioerr:                /* In case of error, jump here */
  94. EXIT
  95.